home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mission 3
/
Mission 3.zip
/
Mission 3.iso
/
spiele
/
sac
/
manual
/
chapter5.doc
< prev
next >
Wrap
Text File
|
2012-11-26
|
11KB
|
288 lines
Chapter five
*****************************************************************
Adding extra routines
*****************************************************************
Well, we've got this far, and what we have is just a normal
plain old adventure. But would'nt it be nice to give it that
little something extra to make it stand out.
Music
Has you know, Stos has his own music definer and used properly,
it can be used to compose some rather catchy tunes. It can also
be used to make all kinds of strange sounds which could be used
in an adventure to liven it up a bit.
At the moment, Sac games just load the title screen followed by
the game data then start. Why not give them a title tune, this
will give the player something to listen to while they wait for
the game to finish loading.
75 music 1
80 load"pic.pi1"
90 load"game.adv"
This little program can be entered into a game and play a little
tune. Line 75 expects to find some music in bank 3 and plays the
first tune. Another idea would be to have a collection of tunes
stored in bank 3 and played like this....
75 R=rnd(20) : if R=0 then goto 75
76 music R
This would play a different title tune every time the game is
loaded. Now lets say your game had a pub in it, this routine
could be used as an H_P event to check that if the player enters
a pub the jukebox is playing a different tune is playing each
time he enters. The event would go like this...
150 if LOC=12 then R=rnd(20) : music R
Where location 12 is the location number of the pub.
If you wanted a random tune to play between certain locations
you could try this line.........
150 if LOC>10 and LOC<20 then R=rnd(20) : music R
This plays a random tune between locations 10 and 20.
Another idea is to have a tune playing throughout the game by
just adding a music statement at the start of the game.
50 music 5
As you can see, theres a lot of things you can do with music,
and as Stos plays it on interupt, the game can do other things.
If you want an impressive title tune then you can always play
Stos Tracker music if you have the tracker extensions, but you
can't play it throughout the game as it blocks the keyboard.
75 track load"tune.abk",1 : track play 1
80 load"pic.pi1"
85 if track scan=48 then track stop
Sound
As you know, Stos has its own sound commands which are Boom,
Bell, and Shoot. It also has an Envelope command which can be
used to created all kinds of sounds. You could use the Boom
command if the player attempts to light a match where theres gas
about then print a message telling the player he has just be
blown up. A L_P event could check this.
3010 if WRD$(1)="light" and WRD$(2)="match" and LOC=15 then boom
: print MESSAGE$(4) : goto 2610
So location 15 could be a power station and lighting a match is
dangerous. Shoot could be used if your adventure is about a
gangster and he fires his gun at people.
There is a program called Stos Sound Fx which allows you to make
all different kinds of sounds by using the X-bios chip. This is
availible from various PD librarys like MT Software.
Sampled Sound
The main problem with sampled sound is that it takes up a lot of
memory, how much depends on the speed and length of the sample.
You will have noticed that a Sac game does'nt use a lot of
memory so you should be able to use a sample or two in it.
For an example, a game where the player is in a haunted house
you could record someone laughing, slow it down, add an echo
effect to it and you could play it every time the player dies.
If you have Stos Maestro and sampler extensions you could store
your laugh in an mbk file and use it if the player falls down a
trapdoor to his doom, used as a H_P event.
110 if LOC=18 then print MESSAGE$(1) : samplay 1 : goto 2610
This line informs the player he has fallen through a trapdoor
and the Samplay command plays the creepy laugh and goes to line
2610 which ends the game. If you load Stos Maestro and look in
the Sound folder you will see a file called LAUGH.SAM, try
loading it into Maestro, adding echo and dropping the playback
speed to five then play it. You'll hear an evil laugh.
Here is another example with a L_P event.
3020 if WRD$(1)="kill" and WRD$(2)="monster" and LOC=10 then
samplay 4 : MONSTER=0 : print MESSAGE$(10)
This line would play sample 4 which would be the sound of a
monster screaming and message 4 informs the player that he has
just killed the monster. Note the varible MONSTER, this has been
set to 0 to indicate the monster is dead, the state of the
monster can be check as an H_P event.
150 if MONSTER=0 then print MESSAGE$(1)
160 if MONSTER=1 then print MESSAGE$(2)
Message 1 would be...There is a dead monster here.
Message 2 would be...There is an ugly monster here
So if MONSTER is set to 0 the monster is dead but if its set to
1 then its alive. More about this later on.
As you may or may not know, Maestro allows you to add different
effects to samples such as Echo, Room and Hall to name but a
few. Try recording a child saying 'mamma mamma', record it with
Maestro at a speed of 12, add a Room effect to it then play it.
What you hear sounds like the ghost of a child crying for its
mother behind a wall. This move would certainly get the players
attention in an horror game.
Another idea would be to record warriors battling with their
swords, add Hall effect and play it when the player enters a
loction where the ghost of long dead warriors still battle on.
200 if LOC=30 then samloop on : samplay 5 else samloop off
Here we see the use of the Samloop command, this could also be
used if the player sees an helicopter.
Theres thousands of effects you can create with music and sound
which would certainly make your game stand out from the crowd.
Characters
In adventure games, a character could be anything from a human
to an animal, maybe even the odd monster of two, this can be
used to make your game world more real.
If you have been playing the example games on this disk, you
will see that the game Haunted House has one called Ray. This is
the main characters mate whos always complaining, in fact people
may keep playing this game to see what Ray does next. This idea
adds a bit of humour to the game. Lets see how its done.
Load the creator, then load the file House.Adv from the House
folder and select the Messages option. List the messages (l) and
look at messages 18 to 30. These are Rays messages and as you
see he gets up to all sorts.
If you look at the source code for this game (house.bas) and
look at the H_P events you will see this.
350 RAY=rnd(30):if RAY<18 then goto 350
360 print MESSAGE$(RAY)
So Ray stays with the player moving to the same location as them
and carrys on grumbling and doing silly things.
Line 350 tells Stos to choose a random message and if its less
than 18, to go back and try again, this is because Rays messages
are between 18 and 30.
Heres another method that puts a character in random locations.
370 L=rnd(40):if L=0 then goto 370
380 if L=LOC then print MESSAGE$(8)
L= Location of the character
LOC= Location of the player
So if the character appears in the location the player enter
then message 8 is printed.
Fighting a character
Lets say that your adventure required you to kill a troll, now
this troll could be killed with just one hit or may he's tough
and can take a few hits. To kill him with one hit can be done
with this line as a L_P event.
3100 if WRD$(1)="kill" and WRD$(2)="troll" and TROLL=LOC then
TROLL=0 : print MESSAGE$(10)
So if the player types "kill troll" and the Troll is in the same
location as the player then kill him off and print message 10.
So when that location is entered again, an H_P event could tell
the player the troll is dead.
400 if TROLL=0 then print MESSAGE$(1)
Or if he's alive.
410 if TROLL=1 then print MESSAGE$(2)
In chapter 6 I shall explain how a character is killed by a few
hits with the same applying to the player.
In this next example I will show you how to get a character to
join a player when they meet.
First lets define a character called Susan, this character will
meet up with the player in the pub then go with him.
First we define a varible to put Susan in the pub.
80 SUSAN=10
Where location 10 is the location number of the pub.
Now we use an H_P event to check if the player meets up with
her and to put them together.
350 if LOC=10 and MEET=0 then MEET=1:print MESSAGE$(9)
The varible MEET is used to check if the couple have met, if so
it would be set to one, otherwise it would be set to 0.
Message 9 would say something like......
A girl comes over, tells you her name is Susan, and mentions
that she's going with you.
And finally, another H_P event to check if there still together.
360 if MEET=1 then SUSAN=LOC : print MESSAGE$(15)
Thats all for characters for now, maybe you can think of some
more uses for them. The skys the limit.
Objects
In a game of wizardry, your player could cast a spell to
tranform an object from one location to the other like this.
3200 if WRD$(1)="cast" and WRD$(2)="spell" then OBLOC(2)=10 :
print MESSAGE$(7) : DONE=1
This sends object 2 to location 10.
You could use Not Created objects for different effects, for
example, you could use an H_P event to tell the player that an
elf has an axe. The axe would be defined as a Not Created object
and created when the elf is killed.
380 if ELF=LOC then print MESSAGE$(5)
Where message 5 would say.. There is an elf here with an axe.
Now we use a L_P event to kill the elf and make him drop the
axe which would be moved from the Not Created location to the
players present location then kill the elf.
3210 if WRD$(1)="kill" and WRD$(2)="elf" then print MESSAGE$(2) :
OB_LOC(8)=LOC : ELF=0 : DONE=1 : SC0RE=SC0RE+100
Now add the final H_P event to mention the elf is dead.
390 If ELF=0 then print MESSAGE$(1)
Well thats it for this chapter, I hope you find some useful
ideas here to put in your games. Don't be afraid to try
different ideas and if you get stuck, then drop me a line at the
usual address and I'll try to put you on the right track.
In chapter 6 we are going to write a small adventure game.